package cn.dengta.webapp.user.form.query;

import cn.dengta.common.model.TimeInterval;
import cn.dengta.context.model.WesKit;
import cn.dengta.webapp.base.form.BaseForm;
import cn.dengta.webapp.user.entity.User;
import cn.dengta.webapp.user.entity.UserDestroyLog;
import cn.dengta.webapp.user.model.Gender;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.X;

@Getter
@Setter
public class UserDestroyQuery extends BaseForm<UserDestroyLog> {

	public Long id;
	/** 昵称 */
	protected String nickname;
	protected Long agentId;
	/** 注销原因 */
	protected String destroyRemark;
	/** 状态 */
	public Integer status;
	protected TimeInterval addTimeInterval;
	@Setter(AccessLevel.NONE)
	protected User user;
	/** 性别 */
	public Gender gender;
	/** 马甲包 */
	public WesKit wesKit;

	public void setWesKit(Integer wesKit) {
		this.wesKit = WesKit.of(wesKit);
	}

	public void setUserNickname(String nickname) {
		user().setNickname(nickname);
		this.nickname = nickname;
	}

	public void setUserId(Long id) {
		user().setId(id);
	}

	private User user() {
		return user = X.getElse(user, User::new);
	}

	public void setGender(Integer gender) {
		this.gender = Gender.of(gender);
	}

}
